UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'iZ5/KcV+y8+/f4Xs7zH2WPrLCftgIXttk0eSINZyoys=' 
WHERE 
  key_id = 'f4483c80fefb1c353382cb75d75bad1e427fd625242932af7aba670881e164cf' 
  AND (
    token = 'iZ5/KcV+y8+/f4Xs7zH2WPrLCftgIXttk0eSINZyoys=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00059