UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'gWA9Ysp7gA6/GuNR8Yha0wPcqXBahQI5if5aDX4ZJNc=' 
WHERE 
  key_id = '8ff613c7e5351e0d9724d1a19036bfdec57154b0f9749956bd6bfaf52bca4e66' 
  AND (
    token = 'gWA9Ysp7gA6/GuNR8Yha0wPcqXBahQI5if5aDX4ZJNc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00050