UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'BGJ03wl9uOk7SOkR1wdyLrtirbWhvTEMU+3qgSMKZnI=' 
WHERE 
  key_id = '86cff3bfada9a81c4d544602aa8667999ca84730e27d6d9d455fbeee9f9ce8a0' 
  AND (
    token = 'BGJ03wl9uOk7SOkR1wdyLrtirbWhvTEMU+3qgSMKZnI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00020