UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'y/pIdAof6BCI5JZ2+AC3Iccqpyycuqt/vtCqhDa6Jik=' 
WHERE 
  key_id = 'd7a31c351fea2bffd2138541d7d2172200f9317e3586a27ec432e80429d7fae0' 
  AND (
    token = 'y/pIdAof6BCI5JZ2+AC3Iccqpyycuqt/vtCqhDa6Jik=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023