UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'mGnOlgjRh7W9NhzboH2955VkWlO25rLdExevFbwuTZE=' 
WHERE 
  key_id = 'c3f0583ca257d81df31dddd898153f776462ee67b573856ed63e553f8945a956' 
  AND (
    token = 'mGnOlgjRh7W9NhzboH2955VkWlO25rLdExevFbwuTZE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033