UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '+fyQhCHvB5bMLdidpeMCiUMcyBBslCYPFZ01wtZE4Qw=' 
WHERE 
  key_id = '4145dfa09dcd284b78861f96359d2075cc48975a02a663a6932065c9048e16e0' 
  AND (
    token = '+fyQhCHvB5bMLdidpeMCiUMcyBBslCYPFZ01wtZE4Qw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00049