UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'V86UHv9kulvb57R2xwUXr9u3MuMuKPZ63VmrXv9wlxA=' 
WHERE 
  key_id = '81b6874e8c9cf6a52b7a1f54530b830a1dea501c817ca4853837bcd209ad16de' 
  AND (
    token = 'V86UHv9kulvb57R2xwUXr9u3MuMuKPZ63VmrXv9wlxA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025