UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Nt8gkks1WuUDbjstfucV0R0OZD+47dkewCoqdB3zPRE=' 
WHERE 
  key_id = '0eb60b14c87c143de7a5d1046557e5c68c14870ee16a4a90875391d2c25564b8' 
  AND (
    token = 'Nt8gkks1WuUDbjstfucV0R0OZD+47dkewCoqdB3zPRE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026