UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'xPJJjWPi21d12QnLcNpXCy3xgCDKqmX+hftYMqjY8OM=' 
WHERE 
  key_id = 'dd94f1dce939887145a8bfcc013306d35ebf774b25badc95acef3638c8fda427' 
  AND (
    token = 'xPJJjWPi21d12QnLcNpXCy3xgCDKqmX+hftYMqjY8OM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026