UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'VhGZ12NFAyTnl0NzYgchb1LISRUnV7qId48DdSyzlo0=' 
WHERE 
  key_id = 'cfd9e1c9a5cca8c56420e39b2a6e3c3ab93cbc71dac85472fbcb6b571dce945d' 
  AND (
    token = 'VhGZ12NFAyTnl0NzYgchb1LISRUnV7qId48DdSyzlo0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035