UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'WYBXYfGgbPLhq5Gdlt4fZ20c3GiqwA6Pk8I4TbjfNt8=' 
WHERE 
  key_id = '3188c5cac32a67289c90267a8dff9bf2fd8c91a609fce6c585dfab2d477fb4c5' 
  AND (
    token = 'WYBXYfGgbPLhq5Gdlt4fZ20c3GiqwA6Pk8I4TbjfNt8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040