UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'hnttlW3hLP7OI98YDXMtpCj7q6ef54AdnuIqUAZvZ3M=' 
WHERE 
  key_id = '3d8eef2c2f3d8bde77119d0eed0c4c0be05df3660b95384a964b693be82cbec5' 
  AND (
    token = 'hnttlW3hLP7OI98YDXMtpCj7q6ef54AdnuIqUAZvZ3M=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00041