UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ak7ULkiK2W5wqkipeaJd5juMmkxwoPl5oHdo0GcoW94=' 
WHERE 
  key_id = 'b98bb19c617affb3dfed3433f77b953eb56003c090c477aaa73378ca983b5624' 
  AND (
    token = 'ak7ULkiK2W5wqkipeaJd5juMmkxwoPl5oHdo0GcoW94=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036