UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'UGmO5YMjNx7XU4f36wMG5qH+33z6pEBvzT/vfYibVtM=' 
WHERE 
  key_id = 'a80fd0b6e9d15fea41f0b2e6ca660e431965d447d18e330717d24e141f5f2319' 
  AND (
    token = 'UGmO5YMjNx7XU4f36wMG5qH+33z6pEBvzT/vfYibVtM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00047