UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'E8G4N6sdjoVq15DrQMT95dD2MAYGKb0461keEIsvngA=' 
WHERE 
  key_id = '4743e2236f38fdc4ab031cffddda8e2e98050cc7906bd8b92d3e1b07549593bb' 
  AND (
    token = 'E8G4N6sdjoVq15DrQMT95dD2MAYGKb0461keEIsvngA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035