UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'YIfTwKLhwQ8UVIEnwhW7JE1nyY2MfbleRsYQ18Sdc6Q=' 
WHERE 
  key_id = '9a90e8647e20ac1f8ceded20bc2a1527b65957dd6cdba8a9bfb8d7fcc568793b' 
  AND (
    token = 'YIfTwKLhwQ8UVIEnwhW7JE1nyY2MfbleRsYQ18Sdc6Q=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00024