UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'S09k41le6MW0eeXQZokX/fWOklmZ5aVC10REXQlnvL0=' 
WHERE 
  key_id = 'b2d455bd1f0bda7b59f85a66565ecc848da1912f205726d59c8714283544d673' 
  AND (
    token = 'S09k41le6MW0eeXQZokX/fWOklmZ5aVC10REXQlnvL0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00021