UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'MXyaRpu3xzmlBAOu8pd/Ai5wbtNIgtJbyoaaiTPTYkE=' 
WHERE 
  key_id = '38af4a7c7bfe95179960b139a9e58bbd9856f993319e13db4bb5140affb9d72f' 
  AND (
    token = 'MXyaRpu3xzmlBAOu8pd/Ai5wbtNIgtJbyoaaiTPTYkE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00050