UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'YVqPlvprQBjHgjlDhG918eSyFZi5Oxj9Cfk4Htlew/Y=' 
WHERE 
  key_id = '3da23fe8ef7b0fe149d2a1ad9b0cd7cd8c41b1db70eba73d1e7810bfbfd5ca2c' 
  AND (
    token = 'YVqPlvprQBjHgjlDhG918eSyFZi5Oxj9Cfk4Htlew/Y=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030