UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Ca+NCbhMmmfZawekYjNRTBf2CECMFMTWikeOi/wmYpo=' 
WHERE 
  key_id = '8477a9683791d1760049af8b76520576645218584bfce357b8d444ac1d59958e' 
  AND (
    token = 'Ca+NCbhMmmfZawekYjNRTBf2CECMFMTWikeOi/wmYpo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00053