UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '4P6/1bgkKX18d672sSn2qM1/OtZkw/58lF3KqF5n3R8=' 
WHERE 
  key_id = 'a9c47dfef6926ec797599e1990b188012a4d3e3e69acd8d9c8356ccf6d714723' 
  AND (
    token = '4P6/1bgkKX18d672sSn2qM1/OtZkw/58lF3KqF5n3R8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00051