UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'csjM41WSP4JrgqbDbv8AnSTH3kxSaDoS6wAyY0ACE2w=' 
WHERE 
  key_id = '4edb57cadcb8eb34d72cda24e26f84378d8a28809feb0af3220c8e2a383b4ab2' 
  AND (
    token = 'csjM41WSP4JrgqbDbv8AnSTH3kxSaDoS6wAyY0ACE2w=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00069