UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'NBhnEh49fFzvpu3BdHAciHGSx/2vShHjlhO0pswUpNA=' 
WHERE 
  key_id = 'daf2457957be89257bae3387f4e1e51b6cdb77dbd5474958bc1e7e5173587218' 
  AND (
    token = 'NBhnEh49fFzvpu3BdHAciHGSx/2vShHjlhO0pswUpNA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00054