UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '0MFchz6skzQSh4CLyNCEOw9KxwQ00sCZDLNiRzGpi0w=' 
WHERE 
  key_id = 'e78578dacf88ba8b3b3854d894a5961015d9e7a48f7bf241cf60f1c7d97ad238' 
  AND (
    token = '0MFchz6skzQSh4CLyNCEOw9KxwQ00sCZDLNiRzGpi0w=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034