UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'LkWj+zjwQ0vIcHkbfbgKDWrCbvSkYgY5spkvhlPCbkc=' 
WHERE 
  key_id = '8ef30a62c6ea07b92eba40248623919dbea8c4edbf5a50a69965447abe9ad2bc' 
  AND (
    token = 'LkWj+zjwQ0vIcHkbfbgKDWrCbvSkYgY5spkvhlPCbkc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00046