UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'p1xbfc0RhHTDB6i38RpH/N20lQkbwyfPNmsnQau6vls=' 
WHERE 
  key_id = 'db06574e6eca4039db7bdd92c483889a626d88401c5c71c49fb158b5575e842b' 
  AND (
    token = 'p1xbfc0RhHTDB6i38RpH/N20lQkbwyfPNmsnQau6vls=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034