UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'PsSiYEBX4MUeiZ2c7Ec/9XZNfKApUQOWve+IxNUvS0A=' 
WHERE 
  key_id = '8c1a0432b0996045680c3360594475980e9bcfe29d585939c52ee7ae803e0aba' 
  AND (
    token = 'PsSiYEBX4MUeiZ2c7Ec/9XZNfKApUQOWve+IxNUvS0A=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023