UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'cwBKI47DViNupnAUEItJ+QfNYLj6nN9neZdgsbRUPPg=' 
WHERE 
  key_id = '2bd726e81db5314aaff716aafb223f2aaf541a6a1ec79ca95344e9bc9753e18c' 
  AND (
    token = 'cwBKI47DViNupnAUEItJ+QfNYLj6nN9neZdgsbRUPPg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035