UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'e0SRWxHzrt5JEj6M2TPNQe66kNg181x+ZGDph8dMHw0=' 
WHERE 
  key_id = '849d320738f80650ed1702ecf55ba85d5168f2c26a3051bc8761edc8898bc15a' 
  AND (
    token = 'e0SRWxHzrt5JEj6M2TPNQe66kNg181x+ZGDph8dMHw0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00049